<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Vue</title>
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>

<div id="app_j_1">

</div>

<script>
    let v = new Vue({
        el: '#app_j_1',
        data: {
            name: '谷歌',
            url: 'www.google.com'
        },
        computed: {
            site:{
                get:function () {
                    return this.name + ' ' + this.url;
                },
                set:function (value) {
                    let names = value.split(' ');
                    this.name = names[0];
                    this.url = names[names.length - 1];
                }
            }
        }
    });
    //// 调用 setter， vm.name 和 vm.url 也会被对应更新
    v.site = '百度 www.baidu.com';
    document.write('name:'+v.name+"<br/>");
    document.write('url:'+v.url);
</script>

</body>
</html>